﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BW.Demo.Infrastructure.Interfcaes
{
    public interface IBaseRespitory<T> where T : class
    {
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="t">实体对象</param>
        /// <returns>受影响行数</returns>
        Task<int> CreateAsync(T t);
        /// <summary>
        /// 修改实体
        /// </summary>
        /// <param name="t">实体对象</param>
        /// <returns>受影响行数</returns>
        Task<int> UpdateAsync(T t);
        /// <summary>
        /// 根据Id获取单个实体
        /// </summary>
        /// <param name="id">指定的实体Id</param>
        /// <returns></returns>
        Task<T> GetModel(long id);
        /// <summary>
        /// 查询全部实体表达式
        /// </summary>
        /// <returns></returns>
        IQueryable<T> GetAll();
        /// <summary>
        /// 批量新增实体集合
        /// </summary>
        /// <param name="t">食堂集合</param>
        /// <returns>受影响行数</returns>
        Task<int> CreateRangeAsync(List<T> t);
        /// <summary>
        /// 批量修改实体集合
        /// </summary>
        /// <param name="t">食堂集合</param>
        /// <returns>受影响行数</returns>
        Task<int> UpdateRangeAsync(List<T> t);
    }
}
